package com.aclass.xqx.classscreen.utlis;

import java.util.Calendar;

/**
 * Created by xqx on 2017/11/7
 * 时间工具类.
 */

public class ClassCalendar {
    static int year;
    static int month;
    static int day;
    static int hour;
    static int minuts;
    static int secno;
    static Calendar c;
    static String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
    public static String getStringDay(){
        c=Calendar.getInstance();
        year= c.get(Calendar.YEAR);
        month=c.get(Calendar.MONTH);
        day=c.get(Calendar.DAY_OF_MONTH);
        hour=c.get(Calendar.HOUR_OF_DAY);
        return year+"年"+(month+1)+"月"+day+"日";
    }
    //获取日期
    public static String getStringtHour(){
        String strhour="";
        String strsen="";
        String strmon="";
        c=Calendar.getInstance();
        hour=c.get(Calendar.HOUR_OF_DAY);
        minuts=c.get(Calendar.MINUTE);
        secno=c.get(Calendar.SECOND);
        strhour= hour<10?"0"+hour:hour+"";
        strmon= minuts<10?"0"+minuts:minuts+"";
        strsen= secno<10?"0"+secno:secno+"";
        return ""+strhour+":"+strmon+":"+strsen;
    }
    //获取日期
    public static String getIntDay(){
        String strhour="";
        String strsen="";
        String strmon="";
        c=Calendar.getInstance();
        hour=c.get(Calendar.HOUR_OF_DAY);
        minuts=c.get(Calendar.MINUTE);
        secno=c.get(Calendar.SECOND);
        strhour= hour<10?"0"+hour:hour+"";
        strmon= minuts<10?"0"+minuts:minuts+"";
        strsen= secno<10?"0"+secno:secno+"";
        return ""+strhour+strmon+strsen;
    }
    public static String getCardtime(){
        String strmonth="";
        String strday="";
        String strhour="";
        String strsen="";
        String strmon="";
        c=Calendar.getInstance();
        year= c.get(Calendar.YEAR);
        month=c.get(Calendar.MONTH)+1;
        day=c.get(Calendar.DAY_OF_MONTH);
        hour=c.get(Calendar.HOUR_OF_DAY);
        strmonth= month<10?"0"+month:month+"";
        strday= day<10?"0"+day:day+"";
        strhour= hour<10?"0"+hour:hour+"";
//        if (month<10){
//            strmonth="0"+month;
//        }else{
//            strmonth=month+"";
        minuts=c.get(Calendar.MINUTE);
        strmon= minuts<10?"0"+minuts:minuts+"";
        secno=c.get(Calendar.SECOND);
        strsen= secno<10?"0"+secno:secno+"";
        return ""+year+""+strmonth+strday+strhour+strmon+strsen;
    }
    public static String getStringMinuts(){
        String strmonth="";
        String strday="";
        String strhour="";
        String strminuts="";
        c=Calendar.getInstance();
        year= c.get(Calendar.YEAR);
        month=c.get(Calendar.MONTH)+1;
        day=c.get(Calendar.DAY_OF_MONTH);
        strmonth= month<10?"0"+month:month+"";
        strday= day<10?"0"+day:day+"";
        hour=c.get(Calendar.HOUR_OF_DAY);
        minuts=c.get(Calendar.MINUTE);
        if (hour<10){
            strhour="0"+hour;
        }else{
            strhour=hour+"";
        }
        if (minuts<10){
            strminuts="0"+minuts;
        }else{
            strminuts=minuts+"";
        }
        return ""+year+strmonth+strday+strhour+strminuts;
    }
    public static String getStringDays(String hour,String minuts){
        String strmonth="";
        String strday="";
        c=Calendar.getInstance();
        year= c.get(Calendar.YEAR);
        month=c.get(Calendar.MONTH)+1;
        day=c.get(Calendar.DAY_OF_MONTH);
        strmonth= month<10?"0"+month:month+"";
        strday= day<10?"0"+day:day+"";
        return ""+year+strmonth+strday+hour+minuts;
    }
    //获取时间
    public static String getInttimes(){
        c=Calendar.getInstance();
        hour=c.get(Calendar.HOUR_OF_DAY);
        minuts=c.get(Calendar.MINUTE);
        String strminuts="";
        if(minuts<10){
            strminuts="0"+minuts;
        }else{
            strminuts=minuts+"";
        }

        return hour+":"+strminuts;
    }
    //获取周几
    public static int getWeekDays(){
        c=Calendar.getInstance();
        return c.get(Calendar.DAY_OF_WEEK)-1;
    }
    //获取周几
    public static String getHour(){
        String strhour="";
        String strmon="";
        c=Calendar.getInstance();
        hour=c.get(Calendar.HOUR_OF_DAY);
        strhour= hour<10?"0"+hour:hour+"";
        minuts=c.get(Calendar.MINUTE);
        strmon= minuts<10?"0"+minuts:minuts+"";
        strmon=strmon.substring(0,1);
        return strhour+"."+strmon;
    }
    public static String getStringWeekDays(){
        return weekDays[ClassCalendar.getWeekDays()];
    }
}
